package com.roocon.design_pattern.chapter08_active_object;

public class DisplayClientThread extends Thread {
  private final ActiveTask activeTask;

  public DisplayClientThread(String name, ActiveTask activeTask) {
    super(name);
    this.activeTask = activeTask;
  }

  @Override public void run() {
    try {
      for (int i = 0; true; i++) {
        String name = Thread.currentThread().getName() + "-->" + i;
        activeTask.doWork(name);
        Thread.sleep(200);
      }
    }catch (Exception e){
      e.printStackTrace();
    }
  }
}
